package no.sachmuld.methodcombination.examples.reflection.scalatraitstyle;

import no.sachmuld.methodcombination.api.BehaviourChain;
import no.sachmuld.methodcombination.api.reflection.Default;

/**
 *
 */
public abstract class Beverage {

    private BehaviourChain<BeverageTrait> chain = new BehaviourChain<>();

    final protected Beverage with(BeverageTrait... beverageTraits) {
        chain.addAll(beverageTraits);
        return this;
    }

    final public double cost() {
        return new Default<Double>().build(BeverageTrait.class, Beverage.class, "cost").execute(this, chain);
    }

    @Override
    final public String toString() {
        return new Default<String>().build(BeverageTrait.class, Beverage.class, "toString").execute(this, chain);
    }
}
